Mega Code Archive
Data Convert Functions
1) A SELECT statement that substitutes a different data type
2) A SELECT statement that uses the COALESCE function
3) COALESCE is equivalent to a CASE expression that returns the first NOT NULL expression in a list of expressions
4) COALESCE() saves quite a lot of IF or CASE decision logic
5) Code that tests whether a database exists before it deletes it
6) Combine CAST and ISNULL
7) Compare date type value after converting
8) Conversion failed when converting the varchar value abc to data type int
9) CONVERT function syntax
10) CONVERT() function requires two arguments
11) CONVERT(char(10), GETDATE(), 112)
12) CONVERT(char(8), BillingDate, 1) and CONVERT(varchar(9), PaymentTotal, 1)
13) CONVERT(datetime, 20000704)
14) CONVERT(varchar(10), advance, 2)
15) CONVERT(varchar(12), OrderDate, 5)
16) CONVERT(varchar(20), GETDATE())
17) CONVERT(varchar,BillingDate,100) Mmm dd yyyy hh
18) CONVERT(varchar,BillingDate,101) mmddyyyy
19) CONVERT(varchar,BillingDate,103) ddmmyyyy
20) Data type conversion can be performed using the CAST() and CONVERT() functions
21) Performing Flexible Searches Using ISNULL
22) Replacing null values with zero values with ISNULL
23) Returning a NULL Value When Two Expressions Are Equal
24) Returning the First Non NULL Value in a List of Expressions
25) SELECT ANSI Date
26) SELECT CAST(123 4 AS Decimal)
27) Select CAST(2002-09-30 11
28) Select CAST(CAST(2002-09-30 AS datetime) - CAST(2001-12-01 AS datetime) AS int)
29) Select CONVERT (INTEGER , 123)
30) SELECT CONVERT(datetime, 10 12 99,1)
31) SELECT CONVERT(datetime, 10 12 99,4)
32) SELECT CONVERT(VarChar(50), @Num, 0)
33) SELECT Default Date
34) SELECT German Date
35) SELECT statement using the ISNULL function
36) SELECT UKFrench Date
37) SELECT US Date
38) System function ISNULL allows a display of the specified value as substitution for NULL
39) The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
40) The DROP Database Statement
41) The syntax of the CAST function
42) The syntax of the CONVERT function CONVERT(data_type, expression [, style])
43) The syntax of the ISNULL function
44) Update and ISNULL
45) Use cast function in dynamic sql
46) Use convert function with variables
47) Values for the style argument of the CONVERT function when you convert a datetime expression to a character express